import {
  defineAsyncComponent,
  markRaw,
} from 'vue';

const components = import.meta.glob("./**/index.vue");
const comFormSchemas = import.meta.globEager("./**/index.js");
const previewComs = Object.keys(components).reduce((prev, cur) => {
    const name = cur.split('./')[1].split('/index.vue')[0];
    prev[name] = markRaw(defineAsyncComponent(() => import(cur)));
    return prev;
}, {});
const previewComFormSchemas = Object.keys(comFormSchemas).reduce((prev, cur) => {
    const name = cur.split('./')[1].split('/index.js')[0];
    prev[name] = comFormSchemas[cur].default;
    return prev;
}, {});
export default {
    previewComs,
    previewComFormSchemas
};